package com.investment.advisor.repository;

import com.investment.advisor.entity.Strategy;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface StrategyRepository extends JpaRepository<Strategy, Long> {
    List<Strategy> findByNameContaining(String keyword);
    
    @Query("SELECT s FROM Strategy s JOIN s.strategyFactors sf WHERE sf.factor.id = :factorId")
    List<Strategy> findByFactorId(@Param("factorId") Long factorId);
} 